package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IProductService;
import cn.wolfcode.trip.base.service.IProductTypeService;
import cn.wolfcode.trip.base.util.UploadUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/types")
public class ProductTypeController {
    @Autowired
    private IProductTypeService productTypeService;
    @Autowired
    private IProductService productService;
    /*
    *查看商品分类
    * 资源:/types
    * 动作:GET
    * 参数:
    **/
    @GetMapping
    public Object getType(QueryObject qo){
        return productTypeService.query(qo);
    }


    /*
     *查看商品分类下的商品
     * 资源:/types
     * 动作:GET
     * 参数:
     **/
    @GetMapping("/{id}/products")
    public Object getProduct(@PathVariable Long id,QueryObject qo){
        return productService.selectProductById(id,qo);
    }
}
